home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / quicktime / quicktime for java / draggingsprites / src / ds / actions / rotateaction.java next >
Encoding:
Java Source  |  2000-06-23  |  2.2 KB  |  62 lines

  1. /*
  2.  * QuickTime for Java SDK Sample Code
  3.  
  4.    Usage subject to restrictions in SDK License Agreement
  5.  * Copyright: © 1996-1999 Apple Computer, Inc.
  6.  
  7.  */
  8. package ds.actions;
  9.  
  10. import quicktime.app.actions.*;
  11. import quicktime.QTException;
  12. import quicktime.qd.*;
  13. import quicktime.std.StdQTException;
  14. import quicktime.std.image.Matrix;
  15. import quicktime.app.display.QTDrawable;
  16. import quicktime.app.image.Transformable;
  17. import java.awt.Dimension;
  18. /**
  19.  * This class provides the capability of moving and bouncing a Transformable
  20.  * object around within the space provided by the QTDrawable space that is
  21.  * the space within which the transformable object is displayed, by the amount specified
  22.  * by the deltaMatrix object.
  23.  */ 
  24. public class RotateAction extends MatrixAction {
  25. //____________________________ CLASS VARIABLES
  26. //____________________________ CLASS METHODS
  27.     /**
  28.      * Constructs a BounceAction object.
  29.      * @param deltaX the amount by which the object is moved in the X dimension
  30.      * @param deltaY the amount by which the object is moved in the Y dimension
  31.      * @param space the space within which the object will be bounced and moved
  32.      * @param scale the amount with which a second is divided into at a rate of one
  33.      * @param period the number of scale ticks that elapse between invocations of the action.
  34.      * @param target the target of the bounce action - the object that is moved
  35.      */
  36.     public RotateAction (int scale, int period, QTDrawable space, Transformable t) throws QTException {
  37.         super (scale, period, space, t);
  38.         doConstraintBoundsTesting = false;
  39.      }
  40.  
  41. //____________________________ INSTANCE VARIABLES
  42.     private float deltaDegree = 1;
  43. //____________________________ INSTANCE METHODS    
  44.     protected void rateDirectionChanged (boolean forwards) throws QTException {
  45.         deltaDegree = -deltaDegree;
  46.     }
  47.     
  48.     protected void transformMatrix (Matrix theMatrix) throws QTException {
  49.         theMatrix.rotate (deltaDegree, theMatrix.getTx(), theMatrix.getTy());
  50.     }
  51. }
  52.  
  53. /*
  54.  * $Log: /Biscotti/QTJavaDemos/DraggingSprites/src/ds/actions/RotateAction.java $
  55.  * 
  56.  * 2     3/11/99 5:36 PM Roger Smith
  57.  * Update Source License Agreement
  58.  * 
  59.  * 1     16/11/98 6:50 PM Bill Stewart
  60.  * new action
  61.  */
  62.